<script>
APP.rewardPunishmentUniversitas = {
	action: 'proc/admin/rewardPunishmentUniversitas.php',
	periode1: null,
	periode2: null,
	
	load_graph: function (form){
		var showImage = function(){
			if ($('graphContainer').getElement('img').complete) $('graphContainer').tween('opacity',1);	
			else showImage.delay(1000);
		}
		
		$('graphContainer').tween('opacity',0);	
		FBModal_loading("Loading...", "Generating graph", true, true);
		form.set('action',APP.rewardPunishmentUniversitas.action).set('send',{
			onSuccess: function(res){
				//alert(res);
				if (res) {
					res = res.replace(/href/gi,'onclick');
					$('graphContainer').empty().set('html', res)
						.getElements('area').each(function(item){
							item.addEvent('click', function(e){ new Event(e).stop(); })
								.href="#";
						});
				}
				showImage.delay(1000);
				FBModal_hide();
			}		 
		}).send();
		
	},
	
	load_drillGraph: function (data){
		var proc = data.type==1?
			"proc=graph-drill-reward&month="+data.month+"&year="+data.year : 
			"proc=graph-drill-punishment&month="+data.month+"&year="+data.year
		FBModal_show2( APP.rewardPunishmentUniversitas.action , 'post', proc, true, true, null);
	}
};

	window.addEvent('domready', function(){
		var form = $('rewardPunishmentUniversitas-form');
		load_graph(form);
		APP.rewardPunishmentUniversitas.periode1 = dtpicker_attach0(form.periode1, {timePicker:false, format: 'F-Y', 
			maxDate: { date: <?php echo time()?>, format: 'U' },
			onClose: function(){ 
				APP.rewardPunishmentUniversitas.periode2.options.minDate = {date:APP.rewardPunishmentUniversitas.periode1.attachTo.value, format:'U'};
				APP.rewardPunishmentUniversitas.periode2.formatMinMaxDates();
				APP.rewardPunishmentUniversitas.load_graph(form);
			}
		});
		APP.rewardPunishmentUniversitas.periode2 = dtpicker_attach0(form.periode2, {maxDate:{ date: <?php echo time()?>, format: 'U' }, 
			timePicker:false, format: 'F-Y', onClose: function(){ APP.rewardPunishmentUniversitas.load_graph(form); } 
		});
		APP.rewardPunishmentUniversitas.periode2.options.minDate = {date:APP.rewardPunishmentUniversitas.periode1.attachTo.value, format:'U'};
	});
</script>
<form id="rewardPunishmentUniversitas-form" name="rewardPunishmentUniversitas-form" method="post">
<input type="hidden" name="proc" value="graph" />
<table width="100%" border="0">
<tr>
    <td align="right" width="100">Periode : </td>
    <td><input type="text" id="periode1" name="periode1" value="<?php echo time()?>" /> - <input id="periode2" name="periode2" type="text" value="<?php echo time()?>" /></td>
</tr>
</table>
</form>